home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-04 | 3.3 KB | 122 lines | [TEXT/KAHL] |
- /********************************************************* DEFINITION
- DATE: 9/21/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPWindowManager
-
- SUPERCLASS: CPPObject
-
- This C++ class keeps track of the windows our application uses
-
- ********************************************************************/
-
- #pragma once
-
- #include <CPPWindowManager.h>
- #include <CPPWindow.h>
-
-
- /*-----------------------------------------------------------------*/
- /*------------------------ PUBLIC METHODS -------------------------*/
- /*-----------------------------------------------------------------*/
-
- CPPWindowManager::CPPWindowManager(void) : CPPObjectList ()
- {
- this->frontWindowObject = NULL;
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPWindowManager::~CPPWindowManager(void)
- {
- // Repeatedly dispose of the frontmost window
- // until all the windows we manage are gone
- for (long i = GetNumItems(); i > 0; i--)
- CPPList::DeleteItem (1, TRUE);
- }
-
- /*-----------------------------------------------------------------*/
-
- char *CPPWindowManager::ClassName (void)
- {
- return "CPPWindowManager";
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPWindowManager::DeactivateWindowObject (CPPWindow *theWindow)
- /* deactivate the window object which is passed to us, and activate */
- /* the new front window object (if there is a different one) */
- {
- CPPWindow *newFW = NULL;
-
- if (theWindow)
- {
- theWindow->Deactivate();
- this->frontWindowObject = NULL;
- }
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPWindowManager::ActivateWindowObject (CPPWindow *theWindow)
- /* deactivate the current front window object and activate the one */
- /* which is passed to us */
- {
- if (theWindow)
- {
- if (this->frontWindowObject)
- this->frontWindowObject->Deactivate();
- theWindow->Activate();
- this->frontWindowObject = theWindow;
- }
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPWindow *CPPWindowManager::FrontWindowObject (void)
- /* return the CPPWindow object associated with the front window */
- {
- return FindWindowObject (FrontWindow());
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPWindow *CPPWindowManager::FindWindowObject (WindowPtr theWindow)
- /* return the CPPWindow object associated with theWindow */
- {
- long numItems = this->GetNumItems();
- CPPWindow *TempWindow;
-
- for (long i = 1;i <= numItems; i++)
- {
- TempWindow = (CPPWindow *)((*this)[i]);
- if (TempWindow)
- if (TempWindow->GetWindow() == theWindow)
- return TempWindow;
- }
-
- return NULL;
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPWindowManager::StartManagingWindow (CPPWindow *theWindow)
- /* add this window object to the list of window objects we manage */
- {
- if (theWindow)
- this->AppendItem(theWindow);
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPWindowManager::StopManagingWindow (CPPWindow *theWindow)
- /* Remove the window object from the list of object we manage */
- {
- DeleteItem (theWindow, FALSE);
- if (this->frontWindowObject == theWindow)
- this->frontWindowObject = NULL;
- }
-
- /*-----------------------------------------------------------------*/
-